Determination of leak and respiratory airflow

ABSTRACT

Methods and apparatus for determining leak and respiratory airflow are disclosed. A pressure sensor ( 34 ) and a differential pressure sensor ( 32 ) have connection with a pneumotach ( 24 ) to derive instantaneous mask pressure and airflow respectively. A microcontroller ( 38 ) estimates a non-linear conductance of any leak path occurring at a mask ( 12 ) as being the low pass filtered instantaneous airflow divided by the low pass filtered square root of the instantaneous pressure. The instantaneous leak flow is then the conductance multiplied by the square root of the instantaneous pressure, and the respiratory airflow is calculated as being the instantaneous airflow minus the instantaneous leak flow. The time constants for the low pass filtering performed by the microcontroller ( 38 ) can be dynamically adjusted dependent upon sudden changes in the instantaneous leak flow.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application is a continuation of application Ser. No.12/649,877 filed on Dec. 30, 2009, now allowed, which is a continuationof application Ser. No. 11/223,237 filed on Sep. 8, 2005, now U.S. Pat.No. 7,661,428; which is a continuation of application Ser. No.10/726,114 filed on Dec. 1, 2003, now U.S. Pat. No. 6,945,248; which isa continuation of application Ser. No. 09/902,011 filed on Jul. 10,2001, now U.S. Pat. No. 6,659,101; which is a continuation ofapplication Ser. No. 09/525,042 filed on Mar. 14, 2000, now U.S. Pat.No. 6,279,569; which is a continuation of application Ser. No.08/911,513 filed on Aug. 14, 1997, now U.S. Pat. No. 6,152,129 andAustralian Application No. AU199737625 filed on Aug. 14, 1996, thedisclosures of which are incorporated herein by reference.

FIELD OF THE INVENTION

The invention relates to methods and apparatus for the determination ofleakage airflow and true respiratory airflow, particularly duringmechanical ventilation.

The airflow determination can be for a subject who is eitherspontaneously or non-spontaneously breathing, or moves between thesebreathing states. The invention is especially suitable for, but notlimited to, normally conscious and spontaneously breathing humansubjects requiring long term ventilator assistance, particularly duringsleep.

BACKGROUND OF THE INVENTION

In this specification any reference to a “mask” is to be understood asincluding all forms of devices for passing breathable gas to a person'sairway, including nose masks, nose and mouth masks, nasal prongs/pillowsand endotracheal or tracheostomy tubes.

During mechanical ventilation, breathable gas is supplied for examplevia a mask, at a pressure which is higher during inspiration and lowerduring expiration. It is useful to measure the subject's respiratoryairflow during mechanical ventilation to assess adequacy of treatment,or to control the operation of the ventilator.

Respiratory airflow is commonly measured with a pneumotachograph placedin the gas delivery path between the mask and the ventilator. Leaksbetween the mask and the subject are unavoidable. The pneumotachographmeasures the sum of the respiratory airflow plus the flow through theleak. If the instantaneous flow through the leak is known, therespiratory airflow can be calculated by subtracting the flow throughthe leak from the flow at the pneumotach.

Known methods to correct for the flow through the leak assume (i) thatthe leak is substantially constant, and (ii) that over a sufficientlylong time, inspiratory and expiratory respiratory airflow will cancel.If these assumptions are met, the average flow through the pneumotachover a sufficiently long period will equal the magnitude of the leak,and the true respiratory airflow may then be calculated as described.

The known method is only correct if the pressure at the mask isconstant. If the mask pressure varies with time (for example, in thecase of a ventilator), assumption (i) above will be invalid, and thecalculated respiratory airflow will therefore be incorrect. This isshown markedly in FIGS. 1 a-1 f.

FIG. 1A shows a trace of measured mask pressure in bi-level CPAPtreatment between about 4 cm H₂O on expiration and 12 cm H₂O oninspiration. FIG. 1B shows a trace of true respiratory airflow insynchronism with the mask pressures. At time=21 seconds a mask leakoccurs, resulting in a leakage flow from the leak that is a function ofthe treatment pressure, as shown in FIG. 1C. The measured mask flowshown in FIG. 1D now includes an offset due to the leak flow. The priorart method then determines the calculated leak flow over a number ofbreaths, as shown in FIG. 1E. The resulting calculated respiratory flow,as the measured flow minus the calculating leak flow is shown in FIG.1F, having returned to the correct mean value, however is incorrectlyscaled in magnitude, giving a false indication of peak positive andnegative airflow.

Another prior art arrangement is disclosed in European Publication No.0714670 A2, including a calculation of a pressure-dependent leakcomponent. The methodology relies on knowing precisely the occurrence ofthe start of an inspiratory event and the start of the next inspiratoryevent. In other words, the leak calculation is formed as an average overa known breath and applied to a subsequent breath.

This method cannot be used if the moment of start and end of theprevious breath are unknown. In general, it can be difficult toaccurately calculate the time of start of a breath. This is particularlythe case immediately following a sudden change in the leak.

Furthermore, the method will not work in the case of a subject who ismaking no respiratory efforts, and is momentarily not being ventilatedat all, for example during an apnea, because for the duration of theapnea there is no start or end of breath over which to make acalculation.

The present invention seeks to provide a determination of leak flow andtrue respiratory airflow accounting for the variations in flow through aleak as a function of pressure.

BRIEF SUMMARY OF THE INVENTION

The invention discloses a method for determining instantaneous leak flowat a mask having a leak path during mechanical ventilation, the methodcomprising the steps of:

(a) determining instantaneous airflow at the mask;

(b) determining instantaneous pressure at the mask;

(c) estimating non-linear conductance of said leak path as the low-passfiltered instantaneous airflow divided by the low-pass filtered squareroot of the instantaneous pressure; and

(d) determining said instantaneous leak flow to be said conductancemultiplied by the square root of the said instantaneous pressure.

The invention further discloses a method for determining instantaneousrespiratory airflow for a subject receiving breathable gas by a mask andin the presence of any mask leak, the method comprising the steps of:

(a) determining instantaneous airflow at the mask;

(b) determining instantaneous pressure at the mask;

(c) estimating non-linear conductance of said leak path as the low passfiltered instantaneous airflow divided by the low pass filtered squareroot of the instantaneous pressure;

(d) determining instantaneous leak flow to the said conductancemultiplied by the square root of the said instantaneous pressure; and

(e) calculating the respiratory airflow as the instantaneous air flowminus the instantaneous leak flow.

The invention yet further discloses apparatus for determiningrespiratory airflow for a subject receiving breathable gas by a mask andin the presence of any mask leak, the apparatus comprising:

transducer means located at or proximate the mask to determineinstantaneous mask airflow and pressure; and

processing means for estimating non-linear conductance or said leak pathas the low pass filtered instantaneous airflow divided by the low passfiltered square root of the instantaneous pressure, determininginstantaneous leak flow to be said conductance multiplied by the squareroot of the said instantaneous pressure, and calculating the respiratoryair flows the instantaneous airflow minus the instantaneous leak flow.

The invention yet further discloses apparatus for providing continuouspositive airway pressure treatment or mechanical ventilation, theapparatus comprising:

a turbine for the generation of a supply of breathable gas;

a gas delivery tube having connection with the turbine;

a mask having-connection to the delivery tube to supply said breathablegas to a subject's airway;

transducer means located at or proximate the mask to determineinstantaneous mask airflow and pressure;

processor means for estimating non-linear conductance of said leak pathas the low pass filtered instantaneous airflow divided by the low passfiltered square root of the instantaneous pressure, determininginstantaneous leak flow to be said conductance multiplied by the squareroot of the said instantaneous pressure, and calculating the respiratoryairflow as the instantaneous airflow minus the instantaneous leak flow;and

control means to control the flow generator to, in turn, control themask pressure and/or mask airflow on the basis of the calculatedrespiratory airflow.

The invention yet further discloses a computer program for executing thesteps referred to above.

In one preferred form, time constants of the low pass filtering aredynamically adjusted dependent upon sudden changes in the instantaneousleak flow.

Embodiments of the invention provide advantages over the prior art.There is no need to know when transitions between respiratory phasesoccurs. The independence from knowledge of the subject's respiratorystate has the important result that the leak flow calculation isaccurate in apneic (i.e. no flow) instances on the part of the subjector the mechanical ventilator.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the invention will now be described with reference to theaccompanying drawings in which:

FIGS. 1A-1F show trace of pressure and airflow from which respiratoryairflow is calculated in accordance with a prior art method;

FIGS. 2A and B show schematic diagrams of two embodiments of ventilatoryassistance apparatus;

FIG. 3 is a block flow diagram of a method for determining instantaneousrespiratory airflow; and

FIGS. 4A-4H show traces of pressure, airflow and other variables fromwhich respiratory airflow is calculated;

FIG. 5 shows a schematic diagram of ventilatory assistance apparatus ofanother embodiment;

FIG. 6 shows a fuzzy membership function for the calculation of theextent A₁ to which the time t_(X1) since the most recent positive goingzero crossing of the calculated respiratory airflow is longer than theexpected time T₁;

FIG. 7 shows a fuzzy membership function for the calculation of theextent B₁ to which the calculated inspiratory respiratory airflowf_(RESP) is large positive;

FIG. 8 shows a fuzzy membership function for the calculation of theextent A_(E) to which the time t_(ZE) since the most recent negativegoing zero crossing in the calculated respiratory airflow is longer thanthe expected time T_(E);

FIG. 9 shows a fuzzy membership function for the calculation of theextent B_(E) to which the respiratory airflow f_(RESP) is largenegative; and

FIG. 10 shows the relation between an index J and time constant τ.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

FIG. 2A shows mechanical ventilation apparatus 10 embodying theinvention.

The subject/patient wears a nose mask 12 of any known type. The subjectequally could wear a face mask or nasal prongs/pillows, or alternativelyhave an endotracheal tube or tracheostomy tube in place. Aturbine/blower 14, operated by a mechanically coupled electrical motor16, receives air or breathable gas at an inlet 18 thereof, and suppliesthe breathable gas at a delivery pressure to a delivery tube/hose 20having connection at the other end thereof with the nose mask 12.Breathable gas thus is provided to the subject's airway for the purposeof providing assisted respiration, with the subject's expired breathpassing to atmosphere by an exhaust 22 in the delivery tube 20,typically located proximate to the mask 12.

A pneumotachograph 24 is placed in the delivery tube between the mask 12and the exhaust 22 to provide two pressure signals, P₂ and P₁, acrossthe pneumotachograph, each passed by hoses 28, 30 to a differentialpressure sensor 32. A determination of the flow of gas in the mask 12 ismade the differential pressure, P₂−P₁, resulting in a flow signal f_(d).The mask pressure, P₂, also is passed to a pressure sensor 34 by atapped line 36 taken from the respective hose 28, to generate a deliverypressure signal, p_(m), output from the pressure sensor 34.

Both the flow signal, f_(d), and the pressure signal p_(m), are passedto a microcontroller 38 where they are sampled for subsequent signalprocessing, typically at a rate of 50 Hz.

The microcontroller 38 is programmed to process the flow and pressuresignals (f_(d), P_(m)) to produce an output control signal, y_(o),provided to an electronic motor servo-controller 42 that, in turn,produces a motor speed control output signal, v_(o). This signal isprovided to the motor 16 to control the rotational speed of the turbine14 and provide the desired treatment pressure, P₂, at the nose mask 12.

The motor servo-controller 42 employs a negative feedback controltechnique that compares the actual delivery pressure, in the form of thesignal P_(m), with the control signal y_(o). For convenience, thiscontrol stratagem may be independent of operation of the microcontroller38.

Operation of the controlling of the microcontroller 38, so far as acalculation of respiratory airflow is concerned, broadly is as follows.In a sampled manner, the conductance of any mask leak is calculated thenthe instantaneous flow through the leak is calculated. The flow throughthe leak is subtracted from the total mask flow to calculate the trueinstantaneous respiratory airflow.

FIG. 2B shows an alternative embodiment of a system for determining truerespiratory airflow during mechanical ventilation. The mechanicalventilation system 10 of FIG. 1B differs from that of FIG. 1A firstly inthat the microcontroller 38 plays no part in control of the ventilator50, rather only receives and data processes the electrically transducedmask pressure and flow signals P_(m), f_(d) to determine and generatethe instantaneous respiratory flow f_(RESP). The ventilator 50 has aninternal drive signal provided by an oscillator 44. The motor servocontroller also may or may not receive the mask pressure signal p_(m) asa form of feedback control. Indeed, the ventilator 50 can be realized byany convenient form of known generic ventilation device.

The controlling software resident within the microcontroller 38 performsthe following steps in determining the respiratory airflow as broadlydescribed above, as also shown in the flow diagram of FIG. 3.

The word “average” is used herein in the most general sense of theresult of a low pass filtering step, and is not confined to anarithmetic mean.

1. Repeatedly sample the mask airflow f_(d) to give a sampled signalf_(MASK) for example at intervals of T=20 milliseconds. (Steps 50,52).

2. Calculate the average leak, LP(L), as being the result of low passfiltering the airflow, f_(MASK) with a time constant of 10 seconds.(Step 54).

3. Calculate the average of the square root of the mask pressure,LP(√{square root over (PMASK)}), as being the result of low passfiltering the square root of the mask pressure, P_(MASK), with a timeconstant of 10 seconds. (Step 56).

4. Calculate the conductane, G, of any leak (Step 58), from theequation:

G=LP(L)/LP(√{square root over (PMASK)})

5. Calculate the instantaneous leak flow, f_(LEAK), through the leak(Step 60), from the equation:

f _(LEAK) =G√{square root over (PMASK)}

If there is no leak flow, the value of LP(L) will be equal to zero, aswill G and hence f_(LEAK). Thus the methodology is valid also where leakis equal to zero—no leak.

At this juncture the leak flow has been determined, such as would bedesired for a leak flow detector. If desired, the instantaneousrespiratory airflow can be subsequently determined by the followingstep.

6. Calculate the instantaneous respiratory airflow, f_(RESP), bysubtracting the instantaneous leak from the mask flow (Step 62):

f _(RESP) =f _(MASK) −f _(LEAK)

FIGS. 4A-4H illustrate the methodology of the embodiment described abovewith reference to FIG. 2B. At time, t=21 sec. a continuing leak ofapproximately 1 L/sec is introduced. FIG. 4E shows the mean mask flow.FIG. 4F represents the calculated conductance G, from which the maskleak flow can be estimated as shown in FIG. 4G. Finally, FIG. 4H showshow the calculated respiratory airflow recovers within approximately 30seconds, and, importantly, gives the correctly scaled (true) magnitudeof airflow.

With regard to setting the instantaneous output signal y_(o), themicrocontroller broadly executes the following steps:

7. If the calculated true respiratory airflow f_(RESP) is above athreshold, for example 0.05 L/sec. y_(o) is set to a value correspondingto an inspiratory pressure, P_(INSP). Otherwise y_(o) is set to a valuecorresponding to an expiratory pressure, P_(EXP). In general, P_(INSP)is higher than P_(EXP), but in the case of continuous positive airwayspressure, P_(EXP) may be equal to P_(INSP). (Step 66).

It is to be understood that many other methods of determining y_(o) fromf_(MASK) may be used in step 7, for example as descried in the textPrinciples and Practice of Mechanical Ventilation, edited by Martin J.Tobin (McGraw Hill Inc. 1994).

In order to control ventilation, it is necessary to measure thesubject's ventilation. In the presence of a leak, the ventilationdelivered by the assisted ventilation apparatus is greater than theventilation delivered to the subject. Known devices which servo-controlventilation cope with this by collecting the exhaled air stream with acomplex system of valves, and then measuring the exhaled ventilation.This is inappropriate for devices for use in a domestic setting duringsleep, because of the attendant weight, complexity, and expense. Theembodiment described compensates for the leak by continuously measuringthe nonlinear conductance of the leak, and allowing for theinstantaneous flow through the leak as a function of pressure.

FIG. 5 shows an alternate arrangement for ventilatory assistanceapparatus 10′ embodying the invention. In this arrangement, thepneumotachograph 24′ is interposed between the turbine 14 and thedelivery hose 20.

This arrangement removes the pressure sensing hoses and pneumotachographfrom the region of the mask 12. The pressure at the mask, P_(MASK) iscalculated from the delivery pressure at the turbine 14, and from thepressure drop down the air delivery hose 20, which for any particulardelivery hose is a known function of the flow at the pneumotachograph24. Further, the microcontroller 38 must also calculate the flow throughthe mask from the flow at the turbine 14 less the flow through theexhaust 22, which for any particular exhaust is a known function of thepressure at the mask 12.

In more detail, this involves the steps of, firstly measuring thepressure P₃ at the turbine 14 with the pressure sensor 34 to produce anelectrical signal P_(t). Next the differential pressure P₄−P₃ ismeasured across the pneumotachograph 24′ by the differential pressuresensor 32 to produce an electrical signal f_(t). In a sampled manner,P_(t) and f_(t) are digitized to yield the sampled turbine pressure andflow signals P_(TURBINE) and F_(TURBINE).

The pressure at the mask P_(MASK) and the sampled airflow at the maskf_(MASK) 12 are calculated from the turbine pressure P_(TURBINE) and theflow at the outlet of the turbine F_(TURBINE) as follows:

Calculate the pressure drop AP TUBE down the air delivery tube 20, fromthe flow at the outlet of the turbine F_(TURBINE):

ΔP _(TUBE)=sign(F _(TURBINE))×K ₁(F _(TURBINE))² +K ₂ F _(TURBINE)

-   -   where K₁ and K₂ are empirically determined constants, and        sign (x) is 1 for x≧0 and −1 otherwise.

Calculate the pressure at the mask, P_(MASK), as the pressure at theturbine P_(TURBINE) less the pressure drop ΔP_(TUBE) down the airdelivery tube 20.

P _(MASK) =P _(TURBINE) −ΔP _(TUBE)

Calculate the flow f_(EXHAUST) through the exhaust 22, from the pressureat the mask P_(MASK):

f _(EXHAUST)=Sign(P _(MASK))×K ₃√{square root over (absPMASK)}

-   -   where K₃ is determined empirically.

Calculate the flow, f_(MASK), into the mask 12 as the flow at theturbine 14 less the flow through the exhaust 22:

f _(MASK) =f _(TURBINE) −f _(EXHAUST)

The foregoing embodiments describe low-pass filtering of both theinstantaneous airflow and the square root of the instantaneous pressurewith a time constant τ of 10 seconds. This time constant τ, can beadvantageously dynamically adjustable.

If the conductance of the leak suddenly changes, then the calculatedconductance will initially be incorrect, and will gradually approach thecorrect value at a rate which will be slow if the time constant of thelow pass filters is long, and fast if the time constant is short.Conversely, if the impedance of the leak is steady, the longer the timeconstant the more accurate the calculation of the instantaneous leak.Therefore, it is desirable to lengthen the time constant if it iscertain that the leak is steady, reduce the time constant if it iscertain that the leak has suddenly changed, and to use intermediatelylonger or shorter time constants if it is intermediately certain thatthe leak is steady.

If there is a large and sudden increase in the conductance of the leak,then the calculated respiratory airflow will be incorrect. In particularduring apparent inspiration, the calculated respiratory airflow will belarge positive for a time that is large compared with the expectduration of a normal inspiration. Conversely, if there is a suddendecrease in conductance of the leak, then during apparent expiration thecalculated respiratory airflow will be large negative for a time that islarge compared with the duration of normal expiration.

Therefore, an index of the degree of certainty that the leak hassuddenly changed is derived, such that the longer the airflow has beenaway from zero, and by a larger amount, the larger the index; and thetime constant for the low pass filters is adjusted to vary inverselywith the index. In operation, if there is a sudden and large change inthe leak, the index will be large, and the time constant for thecalculation of the conductance of the leak will be small, allowing rapidconvergence on the new value of the leakage conductance. Conversely, ifthe leak is steady for a long time, the index will be small, and thetime constant for calculation of the leakage conductance will be large,enabling accurate calculation of the instantaneous respiratory airflow.In the spectrum of intermediate situations, where the calculatedinstantaneous respiratory airflow is larger and for longer periods, theindex will be progressively larger, and the time constant for thecalculation of the leak will progressively reduce. For example, at amoment in time where it is uncertain whether the leak is in factconstant, and the subject merely commenced a large sigh, or whether infact there has been a sudden increase in the leak, the index will be ofan intermediate value, and the time constant for calculation of theimpedance of the leak will also be of an intermediate value. Oneadvantage is that some corrective action will occur very early.

Another advantage is that there is never a moment where the leakcorrection algorithm is “out of control” and needs to be restarted, asdescribed for prior art European Patent Publication No. 0 714 670 A2.

In a preferred embodiment, the above index is derived using fuzzy logic.The fuzzy extent A_(I) to which the airflow has been positive for longerthan expected is calculated from the time t_(ZI) since the lastpositive-going zero crossing of the calculated respiratory airflowsignal, and the expected duration T_(I) of a normal inspiration for theparticular subject, using the fuzzy membership function shown in FIG. 6.The fuzzy extent B₁ to which the airflow is large and positive iscalculated from the instantaneous respiratory airflow using the fuzzymembership function shown in FIG. 7. The instantaneous index I_(I) ofthe degree of certainty that the leak has suddenly increased iscalculated as the fuzzy intersection (lesser) of A_(I) and B_(I).

Comparable calculations are performed for expiration as follows. Thefuzzy extent A_(E) to which the airflow has been negative for longerthan expected is calculated from the time t_(ZE) since the lastnegative-going zero crossing of the calculated respiratory airflowsignal, and T_(E), the expected duration of a typical expiration for theparticular subject, using the membership function shown in FIG. 8. Thefuzzy extent B_(E) to which the airflow is large negative is calculatedfrom the instantaneous respiratory airflow using the fuzzy membershipfunction shown in FIG. 9. The instantaneous index I_(E) of the degree ofcertainty that the leak has suddenly decreased is calculated as thefuzzy intersection of A_(E) and B_(E).

The instantaneous index I of the extent to which there has been a suddenchange in the leak (either an increase or a decrease) is calculated asthe fuzzy union (larger) of indices I_(I) and I_(E). The instantaneousindex I is then passed through a peak detector followed by a low passfilter with a time constant of, for example 2 seconds, to yield thedesired index J. Thus if index I becomes momentarily large, index J willbe initially large and remain so for a few seconds. The time constant τfor the low pass filters used in the calculation of the conductance ofthe leak is then adjusted to vary inversely with the index J, as shownin FIG. 10. For example, if the expected duration of a normalrespiratory cycle were 4 seconds the time constant is set to 10 secondsif the index J is zero, (corresponding to complete certainty that theleak is steady), and to 1 second if the index J is unity (correspondingto complete certainty that the leak is suddenly changing), and tointermediate values for intermediate cases.

The embodiments described refer to apparatus for the provision ofventialatory assistance, however, it is to be understood that theinvention is applicable to all forms of mechanical ventilation andapparatus for the provision of continuous positive airway pressuretreatment. The apparatus can be for the provision of a constanttreatment pressure, multi-level (IPAP and EPAP) treatment or autosetting(adjusting) treatment or other forms of mechanical ventilation,including Proportional Assist Ventilation (PAV) as taught by M Younes inthe above-noted text.

The methodology described can be implemented in the form of a computerprogram that is executed by the microcontroller described, or bydiscrete combinational logic elements, or by analog hardware.

Although the invention herein has been described with reference toparticular embodiments, it is to be understood that these embodimentsare merely illustrative of the principles and applications of thepresent invention. It is therefore to be understood that numerousmodifications may be made to the illustrative embodiments and that otherarrangements may be devised without departing from the spirit and scopeof the present invention as defined by the appended claims.

1. A method for determining instantaneous leak flow at a mask having aleak path during mechanical ventilation, the method comprising the stepsof: a) determining instantaneous airflow at the mask; b) determininginstantaneous pressure at the mask; c) estimating non-linear conductanceof said leak path as the low-pass filtered instantaneous airflow dividedby the low-pass filtered square root of the instantaneous pressure; andd) determining said instantaneous leak flow to be said conductancemultiplied by the square root of the said instantaneous pressure.
 2. Amethod for determining instantaneous respiratory airflow for a subjectreceiving breathable gas by a mask and in the presence of any mask leak,the method comprising the steps of: a) determining instantaneous airflowat the mask; b) determining instantaneous pressure at the mask; c)estimating non-linear conductance of said leak path as the low passfiltered instantaneous airflow divided by the low pass filtered squareroot of the instantaneous pressure; and d) determining saidinstantaneous leak flow to be said conductance multiplied by the squareroot of the said instantaneous pressure; and e) calculating therespiratory airflow as the instantaneous airflow minus the instantaneousleak flow.
 3. A method as claimed in claim 2, whereby the time constantsfor said low pass filtering are dynamically adjustable dependent uponsudden changes in said instantaneous leak flow.
 4. A method as claimedin claim 3, whereby said dynamic adjustment comprises the further stepsof: deriving an index of the extent to which said conductance haschanged suddenly; and changing said time constants in an opposite senseto a corresponding change in said index.
 5. A method as claimed in claim4, whereby said index is derived by the steps of: from said calculatedrespiratory airflow, determining the extent to which the absolutemagnitude of calculated airflow is larger than expected for longer thanexpected.
 6. A method as claimed in claim 2, whereby steps (a) and (b)comprise: measuring airflow and pressure in a gas delivery circuitcoupled to said mask; calculating the pressure drop along the deliverycircuit to the mask as a function of said delivery circuit airflow; andcalculating a derived said instantaneous mask pressure as the measureddelivery circuit pressure less the pressure drop; and calculating theairflow through an exhaust of the mask as a function of the derivedinstantaneous mask pressure; and calculating a derived said mask airflowas the measured delivery circuit airflow minus the exhaust airflow. 7.Apparatus for determining respiratory airflow for a subject receivingbreathable gas by a mask and in the presence of any mask leak, theapparatus comprising: transducer means located at or proximate the maskto determine instantaneous mask airflow and pressure; and processingmeans for estimating non-linear conductance of said leak path as the lowpass filtered instantaneous airflow divided by the low pass filteredsquare root of the instantaneous pressure, determining instantaneousleak flow to be said conductance multiplied by the square root of thesaid instantaneous pressure, and calculating the respiratory airflow asthe instantaneous airflow minus the instantaneous leak flow. 8.Apparatus as claimed in claim 7, wherein the time constants for said lowpass filtering are dynamically adjustable dependent upon sudden changesin said instantaneous leak flow.
 9. Apparatus as claimed in claim 8,wherein said processor means dynamically adjusts the time constants byderiving an index of the extent to which said conductance has changedsuddenly, and changing said time constants in an opposite sense to acorresponding change in said index.
 10. Apparatus as claimed in claim 9,wherein said processor means derives said index from said calculatedrespiratory airflow by determining the extent to which the absolutemagnitude of calculated airflow is larger than expected for longer thanexpected.
 11. Apparatus as claimed in claim 7, wherein said transducermeans comprises a pneumotachograph coupled to a differential pressuretransducer.
 12. Apparatus as claimed in claim 11, wherein saidpneumotachograph is located between the mask and the mask exhaust. 13.Apparatus as claimed in claim 11, wherein said transducer means islocated in a gas delivery circuit connected with said mask and remotefrom said mask.
 14. Apparatus for providing continuous positive airwaypressure treatment or mechanical ventilation, the apparatus comprising:a turbine for the generation of a supply of breathable gas; a gasdelivery tube having connection with the turbine; a mask havingconnection to the delivery tube to supply said breathable gas to asubject's airway; transducer means located at or proximate the mask todetermine instantaneous mask airflow and pressure; processor means forestimating non-linear conductance of said leak path as the low passfiltered instantaneous airflow divided by the low pass filtered squareroot of the instantaneous pressure, determining instantaneous leak flowto be said conductance multiplied by the square root of the saidinstantaneous pressure, and calculating the respiratory airflow as theinstantaneous airflow minus the instantaneous leak flow; and controlmeans to control the flow generator to, in turn, control the maskpressure and/or mask airflow on the basis of the calculated respiratoryairflow.
 15. Apparatus as claimed in claim 14, wherein the timeconstants for said low pass filtering are dynamically adjustabledependent upon sudden changes in said instantaneous leak flow. 16.Apparatus as claimed in claim 15, wherein said processor meansdynamically adjusts the time constants by deriving an index of theextent to which said conductance has changed suddenly, and changes saidtime constants in an opposite sense to a corresponding change in saidindex.
 17. Apparatus as claimed in claim 16, wherein said processormeans drives said index from said calculated respiratory airflow bydetermining the extent to which the absolute magnitude of calculatedairflow is larger than expected for longer than expected.
 18. A computerprogram for determining instantaneous respiratory airflow for a subjectreceiving breathable gas by a mask and in the presence of any mask leak,the program receiving input data of instantaneous airflow and pressureat the mask, and comprising the computational steps of: a) determininginstantaneous airflow at the mask; b) determining instantaneous pressureat the mask; c) estimating non-linear conductance of said leak path asthe low pass filtered instantaneous airflow divided by the low passfiltered square root of the instantaneous pressure; d) determininginstantaneous leak flow to be said conductance multiplied by the squareroot of the said instantaneous pressure; and e) calculating therespiratory airflow as the instantaneous airflow minus the instantaneousleak flow.
 19. A method for determining whether a leak flow at a mask ofa patient undergoing mechanical ventilation has suddenly changed, themethod comprising: determining a respiratory airflow of the patient; anddetermining whether the absolute magnitude of the respiratory airflow islarger than expected for longer than expected.
 20. A method as claimedin claim 19, wherein the determining whether the absolute magnitude ofthe respiratory airflow is larger than expected for longer than expectedcomprises determining whether at least one of the following conditionshold: the respiratory airflow during inspiration is large positive for atime that is large compared with an expected duration of a normalinspiration, and the respiratory airflow during expiration is largenegative for a time that is large compared with an expected duration ofa normal expiration.
 21. A method as claimed in claim 19, wherein thedetermining whether the leak flow at the mask has suddenly changedcomprises determining an index J of an extent to which the leak flow atthe mask has suddenly changed.
 22. A method as claimed in claim 21,wherein the determining the index J comprises determining aninstantaneous index I of an extent to which the absolute magnitude ofthe respiratory airflow is larger than expected for longer thanexpected.
 23. A method as claimed in claim 22, further comprisingpassing the instantaneous index I through a peak detector followed by alow pass filter.
 24. A method as claimed in claim 22, wherein thedetermining the instantaneous index I comprises: determining aninstantaneous index II of an extent to which the respiratory airflowduring inspiration is large positive for a time that is large comparedwith an expected duration of a normal inspiration, determining aninstantaneous index IE of an extent to which the respiratory airflowduring expiration is large negative for a time that is large comparedwith an expected duration of a normal expiration, and determining thelarger of the instantaneous index II and the instantaneous index IE. 25.A method as claimed in claim 24, wherein the determining theinstantaneous index II comprises: determining an extent AI to which therespiratory airflow during inspiration is positive for a time that islarge compared with the expected duration of a normal inspiration,determining an extent BI to which the respiratory airflow duringinspiration is large and positive, and determining the lesser of theextent AI and the extent BI.
 26. A method as claimed in claim 24,wherein the determining the instantaneous index IE comprises:determining an extent AE to which the respiratory airflow duringexpiration is negative for a time that is large compared with theexpected duration of a normal expiration, determining an extent BE towhich the respiratory airflow during expiration is large and negative,and determining the lesser of the extent AE and the extent BE.
 27. Amethod as claimed in claim 19, whereby the determining the respiratoryairflow comprises: measuring airflow in a gas delivery circuit coupledto the mask; calculating an instantaneous pressure at the mask;determining an instantaneous leak flow at the mask from the calculatedinstantaneous pressure at the mask; and calculating respiratory airflowas the measured delivery circuit airflow minus the instantaneous leakflow.
 28. A method as claimed in claim 27, wherein the calculating theinstantaneous pressure at the mask comprises: measuring a pressure inthe gas delivery circuit coupled to the mask; calculating a pressuredrop along the delivery circuit to the mask as a function of themeasured delivery circuit airflow; and calculating the instantaneouspressure at the mask as the measured delivery circuit pressure less thepressure drop.
 29. A method as claimed in claim 27, wherein thedetermining the instantaneous leak flow at the mask comprises:estimating a leak conductance; and multiplying the estimated leakconductance by the square root of the instantaneous pressure at themask.
 30. A method as claimed in claim 29, wherein the estimating theleak conductance comprises: determining an instantaneous airflow at themask; and estimating the leak conductance by: low pass filtering thedetermined instantaneous airflow at the mask, and dividing by a low passfiltered square root of the instantaneous pressure at the mask.
 31. Amethod as claimed in claim 30, wherein determining the instantaneousairflow at the mask comprises: computing an exhaust flow as a functionof the instantaneous pressure at the mask; and subtracting the exhaustflow from the measured delivery circuit airflow.
 32. A method as claimedin claim 30, whereby time constants for the low pass filtering aredynamically adjustable dependent upon whether the leak flow has suddenlychanged.
 33. A method as claimed in claim 32, whereby said dynamicadjustment comprises: deriving an index of an extent to which the leakflow at the mask has suddenly changed; and changing said time constantsin an opposite sense to a corresponding change in the index. 34.Apparatus for determining whether a leak flow at a mask of a patientundergoing mechanical ventilation has suddenly changed, the apparatuscomprising: transducer means located at or proximate the mask todetermine a respiratory airflow of the patient; and a processorconfigured to determine whether the absolute magnitude of therespiratory airflow is larger than expected for longer than expected.35. Apparatus as claimed in claim 34, wherein said transducer meanscomprises a pneumotachograph coupled to a differential pressuretransducer.
 36. Apparatus as claimed in claim 35, wherein saidpneumotachograph is located between the mask and a mask exhaust. 37.Apparatus as claimed in claim 34, wherein said transducer means islocated in a gas delivery circuit connected with said mask and remotefrom said mask.
 38. Apparatus for providing continuous positive airwaypressure treatment or mechanical ventilation, the apparatus comprising:a turbine for generation of a supply of breathable gas; a gas deliverytube having connection with the turbine; a mask having connection to thedelivery tube to supply said breathable gas to a patient's airway, themask having a leak path; transducer means located at or proximate themask to determine a respiratory airflow of the patient; a processorconfigured to determine whether the absolute magnitude of therespiratory airflow is larger than expected for longer than expected;and control means to control the flow generator to control aninstantaneous mask pressure on the basis of the determination.
 39. Acomputer readable storage medium storing a computer program comprisinginstructions configured to cause a processor to carry out a method ofdetermining whether a leak flow at a mask of a patient undergoingmechanical ventilation has suddenly changed, the method comprising:determining a respiratory airflow of the patient; and determiningwhether the absolute magnitude of the respiratory airflow is larger thanexpected for longer than expected.